<?php
/* @var $this InventoryController */
/* @var $model Inventory */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'inventory-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'item_id'); ?>
		<?php echo $form->dropDownList($model, 'item_id', CHtml::listData(Item::model()->findAll(), 'id', 'item_desc'),	array('prompt' => 'Select an Item')	); ?>
		<?php echo $form->error($model,'item_id'); ?>
	</div>



<div class="row">
		<?php echo $form->labelEx($model,'date'); ?>
	<?php $this-> widget ('zii.widgets.jui.CJuiDatePicker', array('model'=>$model, 'attribute'=>'date','options' => array ('dateFormat' => 'yy-mm-dd','yearRange' => '-20:+20','changeYear' => 'true','changeMonth' => 'true',),));?>
		<?php echo $form->error($model,'date'); ?>
	</div>
	

	<div class="row">
		<?php echo $form->labelEx($model,'qty_in_stock'); ?>
		<?php echo $form->textField($model,'qty_in_stock'); ?>
		<?php echo $form->error($model,'qty_in_stock'); ?>
	</div>
	
		 <div class="row">
        <?php 
                $criteria = new CDbCriteria();
                $criteria->select = 'id';
                $criteria->condition = 'username=:name';
                $criteria->params = array(':name'=>Yii::app()->user->name);
        ?>
		
                <!-- <?php echo $form->labelEx($model,'User_id'); ?> !-->
                <?php echo $form->dropDownList($model, 'user_id', CHtml::listData(User::model()->findAll('username = :a', array(':a'=>Yii::app()->user->name)), 'id', 'fname'), array('style' => 'display:none')); ?>
                <?php echo $form->error($model,'User_id'); ?> 
        </div>


	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->